
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>Adding new buildcombos styles &#8212; iprPy 0.10.2 documentation</title>
    <link rel="stylesheet" href="../_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
    <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="Adding new database styles" href="adddatabase.html" />
    <link rel="prev" title="Adding new subset styles" href="addsubset.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="adddatabase.html" title="Adding new database styles"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="addsubset.html" title="Adding new subset styles"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">iprPy 0.10.2 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Extending iprPy</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="adding-new-buildcombos-styles">
<h1>Adding new buildcombos styles<a class="headerlink" href="#adding-new-buildcombos-styles" title="Permalink to this headline">¶</a></h1>
<p>The basic steps associated with implementing a new buildcombos style in iprPy
are</p>
<p>#. Create a Python script in the iprPy/input/buildcombos_functions directory.
The file’s name will be the buildcombos style name.</p>
<ol class="arabic simple">
<li><p>In the Python file, define a function named for the style.</p></li>
<li><p>Set __all__ to equal a list containing the function name.</p></li>
</ol>
<p>The defined buildcombos function should follow a few basic rules</p>
<ul>
<li><p>The function takes as parameters</p>
<blockquote>
<div><ul class="simple">
<li><p>database: the database used by prepare.</p></li>
<li><p>keys: the list of keys in the multikeys set that the function builds
values for.</p></li>
<li><p>content_dict: a dictionary for storing loaded file content where the
keys detail the file’s name (and type) and the values are the file’s
content.</p></li>
<li><p>Any other style-specific keyword parameters.  Typically, these are
related to specifying which database records to use in building the input
combinations.</p></li>
</ul>
</div></blockquote>
</li>
<li><p>A dictionary ‘inputs’ is created with keys matching the values in the keys
list given as a function parameter.</p></li>
<li><p>Records are retrieved from the database and used to generate values for the
inputs dictionary.  In generating the values, each input key must be assigned
an equal number of values.  Empty string values can be used to indicate that
the default calculation values for that term are to be used.</p></li>
<li><p>If any of the inputs keys point to a file that may be used by multiple
prepared calculations, the file’s contents can be loaded and stored in
content_dict.  This saves time during prepare as files that are reused only
need to be loaded once.</p></li>
<li><p>The function returns inputs and content_dict.</p></li>
</ul>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="addsubset.html"
                        title="previous chapter">Adding new subset styles</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="adddatabase.html"
                        title="next chapter">Adding new database styles</a></p>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="adddatabase.html" title="Adding new database styles"
             >next</a> |</li>
        <li class="right" >
          <a href="addsubset.html" title="Adding new subset styles"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">iprPy 0.10.2 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" >Extending iprPy</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.1.2.
    </div>
  </body>
</html>